//package com.cloud.share.distribution.rest;
//
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import com.cloud.share.admin.entity.User;
//import com.cloud.share.distribution.biz.MemberInfoBiz;
//import com.cloud.share.distribution.entity.DisMemberInfo;
//import com.cloud.share.distribution.feign.IUserService;
//import com.cloud.share.distribution.rest.param.DisMemberInfoVo;
//import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
//import com.github.wxiaoqi.security.common.rest.BaseController;
//
//import io.swagger.annotations.ApiOperation;
//
//@Controller
//@RequestMapping("memberInfo")
//public class MemberInfoController extends BaseController<MemberInfoBiz,DisMemberInfo> {
//	@Autowired
//	private MemberInfoBiz memberInfoBiz;
//	
//	@Autowired
//	private IUserService userService;
//	
//	/**
//     * 新增会员接口
//     */
//    @PostMapping(value = "/memberAdd")
//    @ResponseBody
//    @ApiOperation(value = "新增会员", notes = "")
//    public ObjectRestResponse<String> add(@RequestBody DisMemberInfoVo memberInfoVo) {
//    	//上级代理商id
//        String superPaltId="";
//        if(StringUtils.isNotEmpty(memberInfoVo.getDisModelId())){
//        	DisMemberInfo param= memberInfoBiz.selectById(memberInfoVo.getDisModelId());
//            if(param==null){
//                return ObjectRestResponse.fail("邀请用户不存在");
//            }else {
//                superPaltId = param.getDisPlatSuper();
//            }
//        }
//        User user=userService.getUser(Integer.parseInt(superPaltId));
//        if(user==null){
//            return ObjectRestResponse.fail("代理商不存在");
//        }
//
//        DisMemberInfo param= memberInfoBiz.selectByUserId(memberInfoVo.getDisUserId());
//        if(param!=null){
//            return ObjectRestResponse.fail("用户已存在");
//        }
//        DisMemberInfo memberInfo=new DisMemberInfo();
//        BeanUtils.copyProperties(memberInfoVo,memberInfo);
//        memberInfo.setDisUserType("0");
//        memberInfo.setDisPlatSuper(memberInfoVo.getDisPlatSuper());
//        memberInfo.setDisPlatLevel(Integer.parseInt(user.getLevel()));
//        memberInfo.setDisPlatFullIndex(user.getFullindex());
//        memberInfo.setDisPlatformId(user.getFullindex().split("\\.")[1]);
//        memberInfo.setType("0");
//        memberInfoBiz.insert(memberInfo);
//        return ObjectRestResponse.ok("操作成功");
//    }
//}